/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 周斌
 * Date: 2023-10-25
 * Time: 23:23
 */
public class Test {
    public static void main(String[] args) {
        int n = 1;
        int ret = 1;
        int sum = 0;
        while (n <= 5) {
            ret *= n;
            sum += ret;
            n++;
        }
        System.out.println(sum);
    }
}
    /*public static void main1(String[] args) {
        int num = 1;
        int sum = 0;
// 外层循环负责求阶乘的和
        while (num <= 5) {
            int factorResult = 1;
            int tmp = 1;
// 里层循环负责完成求阶乘的细节.
            while (tmp <= num) {
                factorResult *= tmp;
                tmp++;
            }
            sum += factorResult;
            num++;
        }
        System.out.println("sum = " + sum);
    }
}
*/